package cn.cnf.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ZhuMeiYi
 * @date 2020/12/5 13:01
 * @description
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 第一个参数：访问映射路径 第二个参数：资源绝对路径
        registry.addResourceHandler("/" + StaticConfig.relativePath + "**").addResourceLocations("file:" + StaticConfig.localPath.replaceAll("\\\\", "/"));
    }
}